# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-binaryornot
pkgname=('python2-binaryornot' 'python-binaryornot')
_pkgname=binaryornot
pkgver=0.4.4
pkgrel=9
pkgdesc='Ultra-lightweight pure Python package to check if a file is binary or text.'
arch=('any')
url='https://pypi.org/project/binaryornot/'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('379e71b41824b9389ea02c64223e26c57694d07b749c197e3a6b9f10558c8d502e9b93a13ae6c3a4bca49064ffc650ce822073dc312fb06e50e06b8a3f04f419')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-binaryornot() {
  depends=('python2' 'python2-chardet')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-binaryornot() {
  depends=('python' 'python-chardet')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

